package cn.nb12.xbox.service.impl;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.nb12.xbox.dao.AreaDao;
import cn.nb12.xbox.po.Area;
import cn.nb12.xbox.service.AreaService;
import cn.nb12.xbox.utils.Assist;
import cn.nb12.xbox.utils.GenerateBusinessCodeService;
@Service
public class AreaServiceImpl implements AreaService{
    @Autowired
    private AreaDao areaDao;
    
    @Autowired
    private GenerateBusinessCodeService generateBusinessCodeService;
    
    @Override
    public long getAreaRowCount(Assist assist){
        return areaDao.getAreaRowCount(assist);
    }
    @Override
    public List<Area> selectArea(Assist assist){
        return areaDao.selectArea(assist);
    }
    @Override
    public Area selectAreaByObj(Area obj){
        return areaDao.selectAreaByObj(obj);
    }
    @Override
    public Area selectAreaById(String id){
        return areaDao.selectAreaById(id);
    }
    @Override
    public int insertArea(Area value){
    	value.setId(generateBusinessCodeService.doWork());
        return areaDao.insertArea(value);
    }
    @Override
    public int insertNonEmptyArea(Area value){
    	value.setId(generateBusinessCodeService.doWork());
        return areaDao.insertNonEmptyArea(value);
    }
    @Override
    public int insertAreaByBatch(List<Area> value){
    	for (Area area : value) {
			area.setId(generateBusinessCodeService.doWork());
		}
        return areaDao.insertAreaByBatch(value);
    }
    @Override
    public int deleteAreaById(String id){
        return areaDao.deleteAreaById(id);
    }
    @Override
    public int deleteArea(Assist assist){
        return areaDao.deleteArea(assist);
    }
    @Override
    public int updateAreaById(Area enti){
        return areaDao.updateAreaById(enti);
    }
    @Override
    public int updateArea(Area value, Assist assist){
        return areaDao.updateArea(value,assist);
    }
    @Override
    public int updateNonEmptyAreaById(Area enti){
        return areaDao.updateNonEmptyAreaById(enti);
    }
    @Override
    public int updateNonEmptyArea(Area value, Assist assist){
        return areaDao.updateNonEmptyArea(value,assist);
    }

    public AreaDao getAreaDao() {
        return this.areaDao;
    }

    public void setAreaDao(AreaDao areaDao) {
        this.areaDao = areaDao;
    }

}